<!--{include manage_header}-->

<div id="bdw" class="bdw">
<div id="bd" class="cf">
<div id="leader">
	<div class="dashboard" id="dashboard">
		<ul>${mcurrent_page_ad('edit')}</ul>
	</div>
	<div id="content" class="clear mainwide">
        <div class="clear box">
            <div class="box-top"></div>
            <div class="box-content">
                <div class="head">
				<!--{if $ads['id']}-->
					<h2>编辑广告</h2>
				<!--{else}-->
					<h2>新建广告</h2>
				<!--{/if}-->
				</div>
                <div class="sect">
				<form id="-user-form" method="post" action="/manage/ad/edit.php?id={$ads['id']}" enctype="multipart/form-data" class="validator">
					
					<div class="field">
						<label>广告图片</label>
						<input type="file" size="30" name="upload_image" id="team-create-image" class="f-input" />
						<!--{if $ads['image']}--><span class="hint">${team_image($ads['image'])}</span><!--{/if}-->
					</div>
					<div class="field">
						<label>广告标题</label>
						<input type="text" size="30" name="title" id="team-create-product" class="f-input" value="{$ads['title']}" datatype="require" require="true" />
					</div>
					<div class="field">
						<label>指向URL</label>
						<input type="text" size="30" name="url" datatype="require" require="true" id="team-create-condbuy" class="f-input" value="{$ads['url']}" />
						<span class="hint">格式如：http://www.tuan001.com/team/123.html</span>
					</div>
					<div class="field">
						<label>开始时间</label>
						<input type="text" size="10" name="begin_time" id="team-create-begin-time" class="date" onFocus="WdatePicker({isShowClear:false,readOnly:false})" value="${date('Y-m-d', $ads['begin_time'])}" maxLength="10" />
						<label>结束时间</label>
						<input type="text" size="10" name="end_time" id="team-create-end-time" class="date" onFocus="WdatePicker({isShowClear:false,readOnly:false})" value="${date('Y-m-d', $ads['end_time'])}" maxLength="10" />
					</div>
					<div class="field">
						<label>位置</label>
						<select name="position">
							<!--${
								$position = require_once(dirname(dirname(dirname(__FILE__))).'/include/configure/ad_position.php');
								foreach($position as $key=>$val){
									if($ads['position'] == $key){
										echo "<option selected value=\"$key\">$val</option>";
									}else{
										echo "<option value=\"$key\">$val</option>";
									}
								}
							}-->
						</select>
					</div>
					<div class="field">
						<label>城市</label>
						<select name="city_id" class="f-input" style="width:160px;">${Utility::Option(Utility::OptionArray($allcities, 'id','name'), $ads['city_id'], '全部城市')}</select>
					</div>
					<div class="field">
						<label>排序</label>
						<input type="text" size="10" name="sort_order" id="team-create-sort_order" class="number" value="${$ads['sort_order'] ? $ads['sort_order'] : 0}" datatype="number"/><span class="inputtip">请填写数字，数值大到小排序</span>
					</div>
					<input type="hidden" name="user_id" value="{$ads['user_id']}">
					<input type="hidden" name="id" value="{$ads['id']}" />
					<input type="submit" value="好了，提交" name="commit" id="leader-submit" class="formbutton" style="margin:10px 0 0 120px;"/>
				</form>
                </div>
            </div>
            <div class="box-bottom"></div>
        </div>
	</div>
<div id="sidebar">
</div>

</div>
</div> <!-- bd end -->
</div> <!-- bdw end -->

<script type="text/javascript">
window.x_init_hook_teamchangetype = function(){
	X.team.changetype("{$team['team_type']}");
};
window.x_init_hook_page = function() {
	X.team.imageremovecall = function(v) {
		jQuery('#team_image_'+v).remove();
	};
	X.team.imageremove = function(id, v) {
		return !X.get(WEB_ROOT + '/ajax/misc.php?action=imageremove&id='+id+'&v='+v);
	};
};

$(function(){
	$('.field input[name="p_id"]').keyup(function(){
		$.get("part.php",{
				'value':$("#partner_id").val()
			},function(data){
			s = $("#partner_id").val();
			if(data=='0') $("#partner_id").css('color','#FFCC33');
			else $("#partner_select").load('part.php?value='+s );
		});
	});

});
</script>
<!--{include manage_footer}-->
